// SettingsPage.qml
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Window 2.15


Page {
        id: settingsPage
        // 背景设置（纯黑色）
        anchors.fill: parent
        background: Rectangle {
        gradient: Gradient {
            orientation: Gradient.Vertical
            GradientStop { position: 0.0; color: "#DC000000" }
            GradientStop { position: 1.0; color: "Black" }
        }
      }



    TextField {
        id: userNameInput
        width: 300
        height: 40
        x: 380
        y: 40
        placeholderText: "请输入关键字"
        placeholderTextColor: "#888888"
        color: "white"
        font.pixelSize: 14
        topPadding: 10
        bottomPadding: 10
        leftPadding: 15
        rightPadding: 15

        // 样式优化
        background: Rectangle {
            radius: 5  // 圆角半径
            color: "black"
            border {
                width: 1
                color: parent.activeFocus ? "black" : "#1C1A7E"
            }

            // 添加平滑过渡动画
            Behavior on border.color {
                ColorAnimation { duration: 150 }
            }
        }

        // 可选的聚焦效果增强
        onActiveFocusChanged: {
            if(activeFocus) {
                focusAnim.start()
            }
        }

        SequentialAnimation {
            id: focusAnim
            PropertyAnimation {
                target: userNameInput.background
                property: "scale"
                to: 1.02
                duration: 100
            }
            PropertyAnimation {
                target: userNameInput.background
                property: "scale"
                to: 1.0
                duration: 100
            }
        }
   }
   Text {
        id: searchKey
        x: userNameInput.x - 60
        y: userNameInput.y + 10
        width: 58
        height: 40
        color: "white"
        text: qsTr("关键字")
        font.pixelSize: 16
   }  
   AnimatedButton {
        
        id:searchButton
        text: "检索"
        onClicked: console.log("点击事件")
        borderRadius: 8
        x:userNameInput.x + userNameInput.width + 20
        y:userNameInput.y
    }


// 页面内容布局
    Column {
        //anchors.centerIn: parent // 居中
        // anchors.top: parent.top     // 顶部对齐
        //anchors.right: parent.right // 右侧对齐
        anchors.left: parent.left // 左侧对齐
        spacing: 50
        anchors.leftMargin: 20
        width: parent.width * 0.8
        y: 30  //整体下移30像素
        
        // 新增顶部图片
        Image {
            id: infoHeaderImage
            // 缓存优化
            cache: true
            source: "qrc:/qt/qml/qtquickapplicationnew/icon/logo.jpg" // 请替换为实际图片路径
            width: parent.width / 10
            height: 50
            fillMode: Image.PreserveAspectCrop
            horizontalAlignment: Image.AlignLeft
        }
        
 
        ImageTextButton {
            iconSource: "qrc:/qt/qml/qtquickapplicationnew/icon/信息.png"
            text: "信息"
            
            // 建议颜色配置
            normalColor: "white"
            hoverColor: "#3A3A3A"
            pressedColor: "#3EB33B"
            
            onClicked: {
            }
        }
 

        ImageTextButton {
            iconSource: "qrc:/qt/qml/qtquickapplicationnew/icon/检查.png"
            text: "检查"
            
            // 建议颜色配置
            normalColor: "white"
            hoverColor: "#3A3A3A"
            pressedColor: "#3EB33B"
            
            onClicked: {
               
            }
        }

        ImageTextButton {
            iconSource: "qrc:/qt/qml/qtquickapplicationnew/icon/分析.png"
            text: "分析"
            
            // 建议颜色配置
            normalColor: "white"
            hoverColor: "#3A3A3A"
            pressedColor: "#3EB33B"
            
            onClicked: {
                
            }
        }
        
        ImageTextButton {
            iconSource: "qrc:/qt/qml/qtquickapplicationnew/icon/报告.png"
            text: "报告"
            
            // 建议颜色配置
            normalColor: "white"
            hoverColor: "#3A3A3A"
            pressedColor: "#3EB33B"
            
            onClicked: {
                
            }
        }

        ImageTextButton {
            iconSource: "qrc:/qt/qml/qtquickapplicationnew/icon/校准.png"
            text: "校准"
            
            // 建议颜色配置
            normalColor: "white"
            hoverColor: "#3A3A3A"
            pressedColor: "#3EB33B"
            
            onClicked: {
                
            }
        }

        ImageTextButton {
            iconSource: "qrc:/qt/qml/qtquickapplicationnew/icon/设置.png"
            text: "设置"
            
            // 建议颜色配置
            normalColor: "white"
            hoverColor: "#3A3A3A"
            pressedColor: "#3EB33B"
            
            onClicked: {
                
            }
        }

        ImageTextButton {
            iconSource: "qrc:/qt/qml/qtquickapplicationnew/icon/帮助.png"
            text: "帮助"
            
            // 建议颜色配置
            normalColor: "white"
            hoverColor: "#3A3A3A"
            pressedColor: "#3EB33B"
            
            onClicked: {
                
            }
        }
        ImageTextButton {
            iconSource: "qrc:/qt/qml/qtquickapplicationnew/icon/退出.png"
            text: "退出"
            
            // 建议颜色配置
            normalColor: "white"
            hoverColor: "#3A3A3A"
            pressedColor: "#3EB33B"
            
            onClicked: {
                Qt.quit()
            }
        }
    }
}
